//package com.ruigi.control.interceptor;
//
//import com.ruigi.common.Basecontext;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//@Component
//@Slf4j
//public class Pojectinterceptor implements HandlerInterceptor {
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        Object employee = request.getSession().getAttribute("employee");
//        if (employee != null) {
//
//            Basecontext.setid((Long) employee);
//            long id = Thread.currentThread().getId();
//            log.info("id+{}", id);
//
////            RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
//            return true;
//        } else {
////                response.getWriter().write(JSON.toJSONString(R.error("NOTLOGIN")));
//            response.sendRedirect("/backend/page/login/login.html");
//            System.out.println("cuocouocououcoucor");
//            return false;
//        }
////        return true
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//        System.out.println("postHandle");
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//        RequestContextHolder.resetRequestAttributes();
//        System.out.println("after");
//    }
//}
